#pragma once
#include"list.h"

template<class iterator,class ref,class ptr>
class Reverseiterator
{
	typedef	Reverseiterator<iterator, ref, ptr> self;
	iterator cur;
	self& operator++()
	{
		--cur;
		return *this;
	}
	self operator++(int)
	{
		iterator tmp = cur;
		--cur;
		return tmp;
	}
	self& operator--()
	{
		++cur;
		return *this;
	}
	self operator--(int)
	{
		iterator tmp(cur);
		++cur;
		return tmp;
	}
	ref operator*()
	{
		iterator tmp = cur;
		--tmp;
		return *tmp;
	}
	bool operator!=(const self& s)
	{
		return cur != s.cur;
	}
	bool operator==(const self& s)
	{
		return cur == s.cur;
	}
	ptr operator->()
	{
		return &(operator*());
	}
};
